package ch18_IO.practice;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;

/**
 * @author yuchao
 * @date 2013-06-08
 * 
 */
public class ch18_07 {
	
	public static List<String> read(String filename) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader(filename));
		String s = "";
		List<String> strList = new LinkedList<String>();
		while ((s = in.readLine()) != null) {
			strList.add(s);
		}
		in.close();
		return strList;
	}
	
	public static void main(String[] args) throws IOException {
		List<String> list = read("ch18_07.java");
		for (ListIterator<String> it = list.listIterator(list.size()); it.hasPrevious();) {
			System.out.println(it.previous());
		}
	}
}
